<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hello World</title>
    <link rel="stylesheet" href="/css/common.css">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
</head>
<body>
<div id="app">
    <div>单价: {{price}} 元</div>
    <div>数量: {{count}} 个</div>
    <div>合计: {{total}} 元</div>
</div>
<script type="text/javascript">
    const app = new Vue({
        el: '#app',
        data: {
            price: 2,
            count: 5
        },
        computed: {
            total: function () {
                return (this.price * this.count).toFixed(2)
            }
        }
    })
</script>
</body>
</html>
